ArcPad Scripting Object Model
Image Object Example
Send Feedback
ArcPad Scripting Object Model Reference > ArcPad Scripting Samples > Image Object Example

Glossary Item Box

Description

Retrieves and sets EXIF tag values for a JPEG file.Retrieves and sets EXIF tag values for a JPEG file.

VBScript Code

Copy Code
 Sub DisplayEXIFInfo
      Dim pImage, strJPEGPath
      Dim dblLat, dblLon, dblAlt, dtTime
      '++ get the JPEG image
      strJPEGPath= CommonDialog.ShowOpen("jpg","JPG - JPEG Image|*.jpg","",&H1000)
      If strJPEGPath = "" Then Exit Sub
      '++ create the Image object and load the JPEG image
      Set pImage = Application.CreateAppObject("Image")
      pImage.Open strJPEGPath
      '++ set title and comments
      pImage.Title = "My Photo"
      pImage.Comments = "Taken by me on a beautiful, sunny day"
      '++ read some EXIF fields
      dblLat = pImage.Properties(2)
      dblLon = pImage.Properties(4)
      dblAlt = pImage.Properties(6)
      dtTime = pImage.Properties(36867)
      '++ display info
      Application.MessageBox "Title: " & pImage.Title & apNewLine & _
                              "Comments: " & pImage.Comments & apNewLine & _
                              "Lat: " & dblLat & apNewLine & _
                              "Lon: " & dblLon & apNewLine & _
                              "Alt: " & dblAlt & apNewLine & _
                              "Time taken: " & dtTime, apInformation, "EXIF"
                             
      '++ clean up
      pImage.Close
End Sub
Sub DisplayEXIFInfo
      Dim pImage, strJPEGPath
      Dim dblLat, dblLon, dblAlt, dtTime
      '++ get the JPEG image
      strJPEGPath= CommonDialog.ShowOpen("jpg","JPG - JPEG Image|*.jpg","",&H1000)
      If strJPEGPath = "" Then Exit Sub
      '++ create the Image object and load the JPEG image
      Set pImage = Application.CreateAppObject("Image")
      pImage.Open strJPEGPath
      '++ set title and comments
      pImage.Title = "My Photo"
      pImage.Comments = "Taken by me on a beautiful, sunny day"
      '++ read some EXIF fields
      dblLat = pImage.Properties(2)
      dblLon = pImage.Properties(4)
      dblAlt = pImage.Properties(6)
      dtTime = pImage.Properties(306)
      '++ display info
      Application.MessageBox "Title: " & pImage.Title & apNewLine & _
                              "Comments: " & pImage.Comments & apNewLine & _
                              "Lat: " & dblLat & apNewLine & _
                              "Lon: " & dblLon & apNewLine & _
                              "Alt: " & dblAlt & apNewLine & _
                              "Time taken: " & dtTime, apInformation, "EXIF"
                             
      '++ clean up
      pImage.Close
End Sub
©2012. All Rights Reserved.